<?php
/**
 * Copyright (C), 2016-2018, Shall Buy Life info. Co., Ltd.
 * FileName: AccessRight.php
 * Description: 说明
 *
 * @author legolas
 * @Create Date    2021/6/9 16:00
 * @Update Date    2021/6/9 16:00 By mxy
 * @version v1.0
 */

namespace Example\Models;

use Example\Filters\QueryFilter;
use Illuminate\Database\Eloquent\Model;

class AccessRight extends BasicModel
{
    public $timestamps = false;

    public function __construct(array $attributes = [])
    {
        $this->_name = $this ;
        parent::__construct($attributes);
    }
    /**
     * FunctionName：scopeFilter
     * Description：
     * Author：lwl
     * @param $query
     * @param QueryFilter $filters
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function scopeFilter($query, QueryFilter $filters)
    {
        return $filters->apply($query);
    }

    protected $table = 'life_business_school_access_rights';

    protected $casts = [
        'status' => 'numeric',
        'is_max_permissions' => 'numeric',
        'business_id' => 'numeric',
    ];

    protected $dates = [
        'created_at',
        'updated_at'
    ];

    protected $fillable = [
        'name',
        'status',
        'remarks',
        'public_key',
        'private_key',
        'business_id',
        'is_big_power',
        'created_at',
        'updated_at'
    ];

    /**
     * FunctionName：business
     * Description：所属业务
     * Author：lwl
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function business():\Illuminate\Database\Eloquent\Relations\BelongsTo
    {
        return $this->belongsTo(AccessRight::class);
    }

}
